// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.

suite("test_default_double") {
    def tableName = "test_default_double"

    sql """ DROP TABLE IF EXISTS ${tableName} """
    sql """
        CREATE TABLE IF NOT EXISTS ${tableName}
        (
            k TINYINT,
            v1 DOUBLE NOT NULL DEFAULT PI,
            v2 DOUBLE NOT NULL DEFAULT E,
            v3 DOUBLE NOT NULL DEFAULT 1.2345,
        )
        UNIQUE KEY(K)
        DISTRIBUTED BY HASH(k)
        PROPERTIES("replication_num" = "1");
    """

    def res = sql "SHOW CREATE TABLE ${tableName}"

    // test show create table
    assertTrue(res[0][1].contains("`v1` double NOT NULL DEFAULT 3.141592653589793"))
    assertTrue(res[0][1].contains("`v2` double NOT NULL DEFAULT 2.718281828459045"))
    assertTrue(res[0][1].contains("`v3` double NOT NULL DEFAULT \"1.2345\""))

    // test insert into.
    sql " insert into ${tableName} (k) values (1); "
    sql " insert into ${tableName} (k) values (2); "
    sql " insert into ${tableName} (k) values (3); "
    sql " insert into ${tableName} (k) values (4); "
    qt_insert_into1 """ select * from ${tableName} order by k; """
}
